package com.zhiteng.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhiteng.entity.Procdef;
import com.zhiteng.mapper.ProcdefMapper;
import com.zhiteng.service.ProcdefService;

@Service
public class ProcdefServiceImpl implements ProcdefService {

	@Autowired
	private ProcdefMapper ProcdefMapper;

	@Override
	public int deleteProcdefBySchoolId(String schoolId) {
		Procdef record = new Procdef();
		record.setSchool_id(schoolId);
		return ProcdefMapper.delete(record);

	}

	@Override
	public void saveProcdef(Procdef procdef) {
		ProcdefMapper.insert(procdef);
	}

	@Override
	public List<Procdef> queryProcdefBySchoolId(String schoolId) {
		Procdef record = new Procdef();
		record.setSchool_id(schoolId);
		return ProcdefMapper.select(record);
	}

	@Override
	public List<Procdef> queryProcdefBySchoolIdAndType(String schoolId, int type) {
		Procdef record = new Procdef();
		record.setSchool_id(schoolId);
		record.setType(type);
		return ProcdefMapper.select(record);
	}

	@Override
	public Procdef queryProcdefBySchoolIdAndTypeAndAssigneeId(String schoolId, int type2, String assigneeId) {
		Procdef record = new Procdef();
		record.setSchool_id(schoolId);
		record.setType(type2);
		record.setAssignee_id(assigneeId);
		return ProcdefMapper.selectOne(record);
	}

	@Override
	public Procdef queryProcdefBySchoolIdAndTypeAndSquence(String schoolId, int type2, int i) {
		Procdef record=new Procdef();
		record.setSchool_id(schoolId);
		record.setType(type2);
		record.setSequence(i);
		return ProcdefMapper.selectOne(record);
	}
}
